DESCRIPTION = "A Robot image with more full-featured + ROS  full package + OpenCV Linux (real time)system functionality installed."

LICENSE = "MIT"

inherit core-image
inherit ros_distro_${ROS_DISTRO}
inherit ${ROS_DISTRO_TYPE}_image

IMAGE_FEATURES += " \
    debug-tweaks \
    tools-profile \
    splash \
    nfs-server \
    ssh-server-dropbear \
    hwcodecs \
    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', '', \
       bb.utils.contains('DISTRO_FEATURES',     'x11', 'x11-base x11-sato', \
                                                       '', d), d)} \
"
RTOS_IMAGE ?= ""
RTOS_IMAGE_mx8mq = "imx8mq_ros_m4_rtos.bin"
RTOS_IMAGE_mx8mm = "imx8mm_ros_m4_rtos.bin"
RTOS_IMAGE_mx8mn = "imx8mn_ros_m7_rtos.bin"
RTOS_IMAGE_mx8mnlite = "imx8mn_ros_m7_rtos.bin"
RTOS_IMAGE_mx8mp = "imx8mp_ros_m7_rtos.bin"

MACHINE_EXTRA_RRECOMMENDS_remove += " imx-m4-demos imx-m7-demos"
WKS_FILE_DEPENDS_remove += " imx-m4-demos imx-m7-demos"
WKS_FILE_DEPENDS_append_mx8m += " ${@bb.utils.contains('XENOMAI_KERNEL_MODE', 'cobalt', '', 'mcore-rtos', d)} "
IMAGE_BOOT_FILES_remove += "imx8mq_m4_TCM_hello_world.bin imx8mq_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin imx8mq_m4_TCM_rpmsg_lite_str_echo_rtos.bin \
    imx7d_sabresd_m4_TCM_Pingpang.bin imx7d_sabresd_m4_TCM_helloworld.bin imx7d_sabresd_m4_TCM_mcctty.bin imx8mm_m4_TCM_hello_world.bin imx8mm_m4_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin \
    imx8mm_m4_TCM_rpmsg_lite_str_echo_rtos.bin imx8mm_m4_TCM_sai_low_power_audio.bin imx8mn_m7_TCM_hello_world.bin imx8mp_m7_TCM_hello_world.bin \
    imx8mp_m7_TCM_rpmsg_lite_pingpong_rtos_linux_remote.bin  imx8mp_m7_TCM_rpmsg_lite_str_echo_rtos.bin \
    imx7ulp_m4_demo.img imx7ulp_wireless_uart_bridge.img imx7ulp_erpc_matrix_multiply_rpmsg_rtos_imxcm4.img imx7ulp_rpmsg_lite_pingpong_rtos.img imx7ulp_rpmsg_lite_str_echo_rtos.img \
"
IMAGE_BOOT_FILES_append_mx8m += " ${@bb.utils.contains('XENOMAI_KERNEL_MODE', 'cobalt', '', '${RTOS_IMAGE}', d)} "


ISP_PKGS = ""
ISP_PKGS_mx8mp = "packagegroup-imx-isp"
ML_PKGS_mx8                = "packagegroup-imx-robot-ml"
ML_STATICDEV_mx8           = "tensorflow-lite-staticdev"

CORE_IMAGE_EXTRA_INSTALL += " \
    packagegroup-core-full-cmdline \
    packagegroup-tools-bluetooth \
    packagegroup-fsl-tools-audio \
    packagegroup-fsl-tools-gpu \
    packagegroup-fsl-tools-gpu-external \
    packagegroup-fsl-tools-testapps \
    packagegroup-fsl-gstreamer1.0 \
    packagegroup-fsl-gstreamer1.0-full \
    ${@bb.utils.contains('DISTRO_FEATURES', 'wayland', 'weston-init', '', d)} \
    ${@bb.utils.contains('DISTRO_FEATURES', 'x11 wayland', 'weston-xwayland xterm', '', d)} \
    ${ISP_PKGS} \
"
IMAGE_INSTALL += " clblast openblas libeigen opencv gmssl-bin ethercat ethercat-modules"

IMAGE_INSTALL += " \
    xenomai \
    ${ML_PKGS} \
    ${@bb.utils.contains('ROS_DISTRO', 'kinetic', 'robot', '', d)} \
    ${@bb.utils.contains('ROS_DISTRO', 'melodic', 'robot', '', d)} \
    ${@bb.utils.contains('ROS_DISTRO', 'dashing', 'ros-base', '', d)} \
    ${@bb.utils.contains('ROS_DISTRO', 'eloquent', 'ros-base', '', d)} \
    ${@bb.utils.contains('ROS_DISTRO', 'foxy', 'ros-base', '', d)} \
"

TOOLCHAIN_TARGET_TASK += " \
    ${ML_STATICDEV} \
"           
